﻿@using MvcAgenda.Resources;
@model MvcAgenda.Domain.Entities.aevent

@{
    ViewBag.Title = Events.EditTitle;
}

<h2>@Events.EditTitle</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend></legend>

        @Html.HiddenFor(model => model.id)
            <div class="row">
        <div class="col-lg-2 col-md-3 col-sm-12 col-xs-12">
        <div class="editor-label">
            @Html.LabelFor(model => model.title)
        </div>        </div>
        <div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
        <div class="editor-field">
            @Html.EditorFor(model => model.title)
            @Html.ValidationMessageFor(model => model.title)
        </div>        </div>
    </div>
        <div class="row">
        <div class="col-lg-2 col-md-3 col-sm-12 col-xs-12">
        <div class="editor-label">
            @Html.LabelFor(model => model.description)
        </div>        </div>
        <div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
        <div class="editor-field">
            @Html.EditorFor(model => model.description)
            @Html.ValidationMessageFor(model => model.description)
        </div>        </div>
    </div>

   @if (User.Identity.Name == "admin")
   {
           <div class="row">
        <div class="col-lg-2 col-md-3 col-sm-12 col-xs-12">
             <div class="editor-label">
            @Html.LabelFor(model => model.user_id)
        </div>        </div>
        <div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
       <div class="editor-field">
            @Html.DropDownListFor(model => model.user_id, (List<SelectListItem>)ViewBag.users)
            @Html.ValidationMessageFor(model => model.user_id)
        </div>        </div>
    </div>
   }
   else
   {
       Html.RenderAction("UserHiddenField", new { controller = "Users", username = User.Identity.Name });
   }
       <div class="row">
        <div class="col-lg-2 col-md-3 col-sm-12 col-xs-12">
        <div class="editor-label">
            @Html.LabelFor(model => model.location_id)
        </div>        </div>
        <div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
        
            @Html.DisplayFor(model => model.location.label) @Events.or 
                </div>
     <div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
            <div class="editor-field">
            @Html.EditorFor(model => model.location_id)
            @Html.ValidationMessageFor(model => model.location_id)
        </div>        </div>
    </div>
        <div class="row">
        <div class="col-lg-2 col-md-3 col-sm-12 col-xs-12">
        <div class="editor-label">
            @Html.LabelFor(model => model.startTime)
        </div>        </div>
        <div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
        <div class="editor-field">
         @if (Model.startTime > DateTime.Now)
         { 
            @Html.EditorFor(model => model.startTime)
            @Html.ValidationMessageFor(model => model.startTime)
         }
         else
         { 
         @Html.DisplayFor(model => model.startTime)
         @Html.HiddenFor(model => model.startTime)
         }

        </div>        </div>
    </div>
        <div class="row">
        <div class="col-lg-2 col-md-3 col-sm-12 col-xs-12">
        <div class="editor-label">
            @Html.LabelFor(model => model.endTime)
        </div>        </div>
        <div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
        <div class="editor-field">
         @if (Model.startTime > DateTime.Now)
         { 
            @Html.EditorFor(model => model.endTime)
            @Html.ValidationMessageFor(model => model.endTime)
         }
         else
         { 
         @Html.DisplayFor(model => model.endTime)
         @Html.HiddenFor(model => model.endTime)
         }
        </div>        </div>
    </div>
        <div class="row">
        <div class="col-lg-2 col-md-3 col-sm-12 col-xs-12">
        <div class="editor-label">
            @Html.LabelFor(model => model.url)
        </div>        </div>
        <div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
        <div class="editor-field">
            @Html.EditorFor(model => model.url)
            @Html.ValidationMessageFor(model => model.url)
        </div>        </div>
    </div>
<div class="row">
        <div class="col-lg-2 col-md-3 col-sm-1 col-xs-2">
        @Html.FontAwesomeActionLink(Events.backToListLink, "Index", null, "fa fa-hand-o-left")
        </div>
        <div class="col-lg-10 col-md-9 col-sm-11 col-xs-10">
        <input type="submit" value="@Events.Save" />
        </div>
    </div>
    </fieldset>
}
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
